<#assign base=request.contextPath />
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>固沙后台管理系统</title>

    <!-- Bootstrap -->
    <link href="${base}/static/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="${base}/static/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="${base}/static/vendors/iCheck/skins/flat/green.css" rel="stylesheet">
    <!-- bootstrap-progressbar -->
    <link href="${base}/static/vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- sweetalert css -->
    <link href="${base}/static/vendors/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- select2 css -->
    <link href="${base}/static/vendors/select2/select2.min.css" rel="stylesheet">
    <!-- dropify css -->
    <link href="${base}/static/vendors/dropify/dropify.css" rel="stylesheet" />
    <!-- summernote css -->
    <link href="${base}/static/vendors/summernote/summernote.css" rel="stylesheet" />
    <!-- Custom Theme Style -->
    <link href="${base}/static/build/css/custom.min.css" rel="stylesheet">
    <!-- diyUpload -->
    <link href="${base}/static/vendors/diyUpload/diyUpload.css" rel="stylesheet">
    <link rel="stylesheet" href="${base}/static/vendors/projectcheck/index.css">
    
    
    <link href="${base}/static/vendors/someupload/common.css" type="text/css" rel="stylesheet">
	<link href="${base}/static/vendors/someupload/index.css" type="text/css" rel="stylesheet">
   
    
  </head>

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title"><i class="fa fa-paw"></i> <span>固沙管理系统</span></a>
            </div>

            <div class="clearfix"></div>

            <!-- menu profile quick info -->
            <div class="profile clearfix">
              <div class="profile_info">
                <span>欢迎您，${admin.userName}</span>
              </div>
            </div>
            <!-- /menu profile quick info -->

            <br />

            <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section">
                <h3>功能菜单</h3>
                <ul class="nav side-menu">
                	<#if listMenus?? && listMenus?size gt 0>
                	<#list listMenus as obj>
	            	<li><a><i class="${obj.menuIcon}"></i> ${obj.menuName} <span class="fa fa-chevron-down"></span></a>
	                	<ul class="nav child_menu">
	                		<#if (obj.list)?? && (obj.list)?size gt 0>
	                		<#list obj.list as obj2>
	                		<li id="${obj2.id?c}"><a href="javascript:showContent('${obj2.menuUrl}','${obj2.id?c}');">${obj2.menuName}</a></li>
	                		</#list>
	                		</#if>
	                    </ul>
	            	</li>
	            	</#list>
	            	</#if>
                </ul>
              </div>
            </div>
            <!-- /sidebar menu -->
          </div>
        </div>

        <!-- top navigation -->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <div class="nav toggle">
                <a id="menu_toggle"><i class="fa fa-bars"></i></a>
              </div>

              <ul class="nav navbar-nav navbar-right">
              	
              	<li class="nav-item dropdown">
                	<a href="${base}/loginOut" class="nav-link dropdown-toggle text-muted waves-effect waves-dark"><i class="fa fa-power-off"></i> 退出登录</a>
                </li>
                <li class="nav-item dropdown">
                	<a data-toggle="modal" data-target="#update_pass_modal" class="nav-link dropdown-toggle text-muted waves-effect waves-dark"><i class="fa fa-cogs"></i> 修改密码</a>
                </li>
                <li class="nav-item dropdown">
                	<a class="nav-link dropdown-toggle text-muted waves-effect waves-dark" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="timeShow"></a>
                </li>
              </ul>
            </nav>
          </div>
        </div>
        <!-- /top navigation -->

        <!-- page content -->
        <div class="right_col" role="main" id="main_content">

        </div>
        <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
            ©2018 All Rights Reserved. GuSha!
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>
	<!-- modals -->
    <#include "../common/modal.ftl" />
    <!-- jQuery -->
    <script src="${base}/static/vendors/jquery/dist/jquery.min.js"></script>
    <!-- jQuery -->
    <script src="${base}/static/vendors/jquery/dist/jquery.form.js"></script>
    <!-- Bootstrap -->
    <script src="${base}/static/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="${base}/static/vendors/fastclick/lib/fastclick.js"></script>
    <!-- iCheck -->
    <script src="${base}/static/vendors/iCheck/icheck.min.js"></script>
     <!-- bootstrap-progressbar -->
    <script src="${base}/static/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- Skycons -->
    <script src="${base}/static/vendors/skycons/skycons.js"></script>
    <!-- sweetalert -->
    <script src="${base}/static/vendors/sweetalert/sweetalert.min.js"></script>
    <!-- select2 -->
    <script src="${base}/static/vendors/select2/select2.full.min.js"></script>
    <!-- dropify -->
    <script src="${base}/static/vendors/dropify/dropify.js"></script>
    <!-- summernote -->
    <script src="${base}/static/vendors/summernote/summernote.min.js"></script>
	<script src="${base}/static/vendors/summernote/summernote-zh-CN.js"></script>
	<!-- diyUpload -->
    <script src="${base}/static/vendors/diyUpload/diyUpload.js"></script>
	<script src="${base}/static/vendors/diyUpload/webuploader.min.js"></script>
    <!-- laydate.js -->
    <script src="${base}/static/vendors/laydate/laydate.js"></script>
    <!-- layer -->
    <script src="${base}/static/vendors/layer/layer.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="${base}/static/build/js/custom.js"></script>
    

    
     
	<script type="text/javascript">
    var t = null;
    /*开始执行*/
    t = setTimeout(time,1000);
    function time(){
        /*清除定时器*/
        clearTimeout(t);
        dt = new Date();
        var y=dt.getYear()+1900;
        var mm=dt.getMonth()+1;
        var d=dt.getDate();
        var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
        var day=dt.getDay();
        var h=dt.getHours();
        var m=dt.getMinutes();
        var s=dt.getSeconds();
        if(h<10){h="0"+h;}
        if(m<10){m="0"+m;}
        if(s<10){s="0"+s;}
        document.getElementById("timeShow").innerHTML = y+"年"+mm+"月"+d+"日 "+weekday[day]+" "+h+":"+m+":"+s+"";
        /*设定定时器，循环执行*/
        t = setTimeout(time,1000);
    }

    $(document).ajaxComplete(function(event,data,settings){
        layer.closeAll('loading');
        /*验证是否为登陆状态*/
        if(data.responseText=="nologin"){
            window.location.href = "${base}";
        }
        /*验证是否有权限*/
        if(data.responseText=="norole"){
            $("#main_content").load("${base}/to403");
        }
        /*验证500*/
        if(data.status=="500"){
            $("#main_content").load("${base}/to500");
        }
        /*验证404*/
        if(data.status=="404"){
            $("#main_content").load("${base}/to404");
        }
    });

    $(document).ajaxStart(function(){
        layer.load();
    });
    /*首页加载页面*/
    function showContent(url,domId) {
        if(url != ''){
            var path = '${base}/'+url;
            $("#main_content").load(path);
        }
        $('.child_menu li').removeClass('active');
        $("#"+domId).addClass("active");
    }
    
    /*内页加载页面*/
    function showRight(url){
        var path = '${base}/' + url;
        $("#main_content").load(path);
    }
    
	function doUpdatePass(){
		var oldPass = $.trim($("#oldPass").val());
		var newPass = $.trim($("#newPass").val());
		var confirmPass = $.trim($("#confirmPass").val());
		if(oldPass==""){
			swal("请输入原密码");
			return ;
		}
		if(newPass==""){
			swal("请输入新密码");
			return ;
		}
		if(confirmPass==""){
			swal("请确认新密码");
			return ;
		}
		if(newPass!=confirmPass){
			swal("两次密码不一致");
			return ;
		}
		$.post('${base}/doUpdatePass',{"oldPass":oldPass,"newPass":newPass},function(data) {
			if (data.flag) {
				swal({
					title: data.msg,
					text: "",
					icon: "success",
					button: "确定",
				},function(){
					window.location.href = "${base}";
				});
			} 
			if(!data.flag){
				swal(data.msg);
			}
		});
	}
</script>
  </body>
</html>